<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>键盘事件</title>
</head>
<body>
    <div class="app">
        <h2>键盘事件</h2>
        <input type="text" name="username" id="username"
               placeholder="输入回车提示信息~"
               @keyup.huiche="showInfo"
        />
    </div>
</body>
<script src="../js/vue.js"></script>
<script>
    // enter delete tab space up down left right
    Vue.config.productionTip = false
    // 自定义键码, 回车事件
    Vue.config.keyCodes.huiche = 13
    const vm = new Vue({
        el:'.app',
        data: {

        },
        methods: {
            showInfo(e) {
                alert(e.target.value)
            }
        }
    })
</script>
</html>